package cn.tedu._05mvcboot03.conmon.reponse;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    @ApiModelProperty(value = "状态码",required = true)
    private Integer stata;
    @ApiModelProperty(value = "提示信息",required = true)
    private String message;
    @ApiModelProperty(value = "响应数据",required = true)
    private Object data;

    public JsonResult(StataCode stataCode, Object data) {
        this.stata = stataCode.getStata();
        this.message = stataCode.getMessage();
        this.data = data;
    }
    public JsonResult(StataCode stataCode) {
        this.stata = stataCode.getStata();
        this.message = stataCode.getMessage();
    }
    public static JsonResult ok(Object data){
        return new JsonResult(StataCode.OPERATION_SUCCESS,data);
    }
    public static JsonResult ok(){
        return ok(null);
    }

}
